package api

import (
	"github.com/gin-gonic/gin"
	"zsc-boot/app/customer/model/request"
	"zsc-boot/app/customer/service"

	"zsc-boot/core/web"
)

type ReportNewApi struct {
	svc *service.ReportSvc
}

func (r *ReportNewApi) ChannelLevelReport(ctx *gin.Context) {
	var req request.ChannelReportReq
	_ = ctx.Bind(&req)

	data, err := r.svc.ChannelLevelReport(req)
	if err != nil {
		web.FailResponse(ctx, err, "查询异常")
		return
	}
	web.SuccessResponse(ctx, data)
}

func (r *ReportNewApi) ChannelReport(ctx *gin.Context) {
	var req request.ChannelReportReq
	_ = ctx.Bind(&req)

	data, err := r.svc.ChannelReport(req)
	if err != nil {
		web.FailResponse(ctx, err, "查询异常")
		return
	}
	web.SuccessResponse(ctx, data)
}

func (r *ReportNewApi) UserReport(ctx *gin.Context) {
	var req request.ChannelReportReq
	_ = ctx.Bind(&req)

	data, err := r.svc.UserReport(req)
	if err != nil {
		web.FailResponse(ctx, err, "查询异常")
		return
	}
	web.SuccessResponse(ctx, data)
}
func NewReportNewApi() *ReportNewApi {
	return &ReportNewApi{svc: new(service.ReportSvc)}
}
